/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Modele;

import java.util.*;

/**
 *
 * @author sgarreau
 */
public class Pays {

    private Collection<Dep> lesDeps;
    private Collection<Spe> lesSpes;
    private Collection<Med> lesMeds;

    public Pays() {
        lesDeps = DAO.getLesDeps();
        lesSpes = DAO.getLesSpes();
        lesMeds = DAO.getLesMeds();
        for (Dep unDep : lesDeps) {
            for (Med unMed : lesMeds) {
                if (unMed.getDep().equals(unDep.getNum())) {
                    unDep.addUnMed(unMed);
                }
            }
        }
        for (Spe unSpe : lesSpes) {
            for (Med unMed : lesMeds) {
                if (unSpe.getLibelle().equals(unMed.getSpe())) {
                    unSpe.addUnMed(unMed);
                }
            }
        }
    }

    public Collection<Dep> getLesDeps() {
        return lesDeps;
    }

    public Dep getLeDep(String numDep) {

        for (Dep unDep : lesDeps) {
            if (unDep.getNum().equals(numDep)) {
                return unDep;
            }
        }
        return null;
    }

    public Collection<Spe> getLesSpes() {
        return lesSpes;
    }

    public Spe getLaSpe(String libelle) {
        for (Spe unSpe : lesSpes) {
            if (unSpe.getLibelle().equals(libelle)) {
                return unSpe;
            }
        }
        return null;
    }
}
